package com.asialjim.wechat.official.message.handler.event;

import com.asialjim.wechat.database.DataBaseService;
import com.asialjim.wechat.message.WeChatMessage;
import com.asialjim.wechat.message.output.WeChatOutputMessage;
import com.asialjim.wechat.msgcrypt.WxBizMsgCryptService;
import com.asialjim.wechat.official.message.WeChatOfficialMessageType;
import com.asialjim.wechat.official.message.event.WeChatClickEvent;
import com.asialjim.wechat.official.message.handler.message.WikiMessageHandler;
import com.asialjim.wechat.official.message.wiki.MsgWikiFunction;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RedissonClient;
import java.util.Map;

/**
 * <h1><em>ASIAL JIM JAVA DOC</em></h1><hr/>
 * <h2>CLASS DESCRIPTION <i>[ NAME: ClickEventHandler ]</i></h2><strong>
 * <p> click event handler
 * </strong><p><p><em>Copyright &copy; Asial Jim Co., LTD</em><hr/>
 *
 * @author Asial Jim &nbsp;&nbsp; <span>Email:<a href="mailto:asialjim@hotmail.com">asialjim@hotmail.com</a> &nbsp;&nbsp; <a href="asialjim@qq.com">asialjim@qq.com</a></span>
 * @version 1.0.0
 * @since 2021/3/16   &nbsp;&nbsp; JDK 8
 */
@Slf4j
public class ClickEventHandler extends WikiMessageHandler {
    public ClickEventHandler(WxBizMsgCryptService cryptService, DataBaseService dataBaseService, Map<String, MsgWikiFunction> wikiFunctionMap, RedissonClient redissonClient) {
        super(cryptService, dataBaseService, wikiFunctionMap,redissonClient);
    }

    @Override
    protected WeChatOutputMessage output(WeChatMessage callMessage){
        WeChatClickEvent event = (WeChatClickEvent) callMessage;
        String eventKey = event.getEventKey();
        return handleWikiMessage(event, eventKey);
    }

    @Override
    public String messageTypeName() {
        return WeChatOfficialMessageType.CLICK_EVENT.name();
    }
}
